import 'package:crypto/crypto.dart';
import 'dart:convert';

class MockDataSource {
  // 用户数据 (默认密码: 123456)
  static List<Map<String, dynamic>> getMockUsers() {
    final defaultPassword = _hashPassword("123456");

    return [
      {
        "_id": "user_001",
        "name": "张小明",
        "email": "zhangxiaoming@example.com",
        "password": defaultPassword,
        "createdAt": "2024-01-15T08:30:00Z",
        "updatedAt": "2024-01-15T08:30:00Z",
      },
      {
        "_id": "user_002",
        "name": "李美丽",
        "email": "limeili@example.com",
        "password": defaultPassword,
        "createdAt": "2024-01-16T09:15:00Z",
        "updatedAt": "2024-01-16T09:15:00Z",
      },
      {
        "_id": "user_003",
        "name": "王旅行",
        "email": "wanglvxing@example.com",
        "password": defaultPassword,
        "createdAt": "2024-01-17T10:20:00Z",
        "updatedAt": "2024-01-17T10:20:00Z",
      },
      {
        "_id": "user_004",
        "name": "陈探险",
        "email": "chentanxian@example.com",
        "password": defaultPassword,
        "createdAt": "2024-01-18T11:45:00Z",
        "updatedAt": "2024-01-18T11:45:00Z",
      },
      {
        "_id": "user_005",
        "name": "刘摄影",
        "email": "liusheying@example.com",
        "password": defaultPassword,
        "createdAt": "2024-01-19T14:30:00Z",
        "updatedAt": "2024-01-19T14:30:00Z",
      },
    ];
  }

  // 密码哈希工具方法
  static String _hashPassword(String password) {
    final bytes = utf8.encode('${password}salt_key');
    final digest = sha256.convert(bytes);
    return digest.toString();
  }

  // 希腊目的地数据
  static List<Map<String, dynamic>> getMockDestinations() {
    return [
      {
        "_id": "dest_001",
        "name": "圣托里尼",
        "nameEn": "Santorini",
        "description":
            "爱琴海上最璀璨的明珠，以其独特的蓝顶白墙建筑、壮观的火山口景观和浪漫的日落而闻名于世。这里是蜜月和度假的绝佳选择。",
        "country": "希腊",
        "region": "基克拉泽斯群岛",
        "latitude": 36.3932,
        "longitude": 25.4615,
        "images": [
          "assets/photo/2.jpg",
          "https://example.com/santorini2.jpg",
          "https://example.com/santorini3.jpg",
        ],
        "coverImage": "assets/photo/2.jpg",
        "rating": 4.9,
        "reviewCount": 2486,
        "tags": ["浪漫", "海岛", "日落", "蜜月", "度假"],
        "climate": {
          "type": "地中海气候",
          "temperature": "15-28°C",
          "season": "四季宜人",
        },
        "bestTravelTime": "4-10月",
        "languages": ["希腊语", "英语"],
        "currency": "欧元",
        "timeZone": 2,
        "createdAt": "2024-01-01T00:00:00Z",
        "updatedAt": "2024-01-20T12:00:00Z",
      },
      {
        "_id": "dest_002",
        "name": "雅典",
        "nameEn": "Athens",
        "description":
            "古希腊文明的摇篮，拥有2500年历史的古城。卫城、帕特农神庙等古迹见证了西方文明的起源，是历史爱好者的朝圣地。",
        "country": "希腊",
        "region": "阿提卡",
        "latitude": 37.9755,
        "longitude": 23.7348,
        "images": [
          "assets/photo/4.jpg",
          "https://example.com/athens2.jpg",
          "https://example.com/athens3.jpg",
        ],
        "coverImage": "assets/photo/4.jpg",
        "rating": 4.8,
        "reviewCount": 1824,
        "tags": ["历史", "文化", "古迹", "博物馆", "首都"],
        "climate": {
          "type": "地中海气候",
          "temperature": "10-32°C",
          "season": "夏季炎热，冬季温和",
        },
        "bestTravelTime": "4-6月，9-11月",
        "languages": ["希腊语", "英语"],
        "currency": "欧元",
        "timeZone": 2,
        "createdAt": "2024-01-01T00:00:00Z",
        "updatedAt": "2024-01-20T12:00:00Z",
      },
      {
        "_id": "dest_003",
        "name": "米克诺斯岛",
        "nameEn": "Mykonos",
        "description":
            "基克拉泽斯群岛中最著名的派对岛屿，以其充满活力的夜生活、美丽的海滩和标志性的风车而闻名。白色立方体建筑构成了独特的海岛风光。",
        "country": "希腊",
        "region": "基克拉泽斯群岛",
        "latitude": 37.4467,
        "longitude": 25.3289,
        "images": [
          "assets/photo/5.jpg",
          "https://example.com/mykonos2.jpg",
          "https://example.com/mykonos3.jpg",
        ],
        "coverImage": "assets/photo/5.jpg",
        "rating": 4.7,
        "reviewCount": 1567,
        "tags": ["海岛", "夜生活", "海滩", "风车", "度假"],
        "climate": {
          "type": "地中海气候",
          "temperature": "16-27°C",
          "season": "夏季干燥，冬季温和多雨",
        },
        "bestTravelTime": "5-9月",
        "languages": ["希腊语", "英语"],
        "currency": "欧元",
        "timeZone": 2,
        "createdAt": "2024-01-01T00:00:00Z",
        "updatedAt": "2024-01-20T12:00:00Z",
      },
    ];
  }

  // 景点数据
  static List<Map<String, dynamic>> getMockAttractions() {
    return [
      {
        "_id": "attr_001",
        "name": "卫城",
        "nameEn": "Acropolis of Athens",
        "description":
            "雅典卫城是古希腊最重要的古建筑群，位于雅典市中心的石灰岩山丘上。帕特农神庙是其中最著名的建筑，代表了古典建筑的巅峰。",
        "destinationId": "dest_002",
        "category": "historical",
        "latitude": 37.9755,
        "longitude": 23.7348,
        "address": "雅典卫城，雅典，希腊",
        "images": ["assets/photo/4.jpg", "https://example.com/acropolis2.jpg"],
        "coverImage": "assets/photo/4.jpg",
        "rating": 4.8,
        "reviewCount": 3245,
        "tags": ["古迹", "世界遗产", "建筑", "历史"],
        "openingHours": {
          "monday": "8:00-20:00",
          "tuesday": "8:00-20:00",
          "wednesday": "8:00-20:00",
          "thursday": "8:00-20:00",
          "friday": "8:00-20:00",
          "saturday": "8:00-20:00",
          "sunday": "8:00-20:00",
        },
        "ticketInfo": {"adult": "20€", "student": "10€", "children": "免费"},
        "visitDuration": 180,
        "difficulty": "medium",
        "facilities": ["wifi", "restroom", "gift_shop", "audio_guide"],
        "isAccessible": false,
        "phone": "+30 210 321 4172",
        "website": "https://www.theacropolismuseum.gr",
        "createdAt": "2024-01-01T00:00:00Z",
        "updatedAt": "2024-01-20T12:00:00Z",
      },
      {
        "_id": "attr_002",
        "name": "伊亚小镇",
        "nameEn": "Oia Village",
        "description": "圣托里尼岛最北端的小镇，以其美丽的日落景色而闻名世界。白色洞穴房屋和蓝顶教堂构成了经典的希腊海岛风光。",
        "destinationId": "dest_001",
        "category": "cultural",
        "latitude": 36.4618,
        "longitude": 25.3753,
        "address": "伊亚，圣托里尼，希腊",
        "images": ["assets/photo/2.jpg", "https://example.com/oia2.jpg"],
        "coverImage": "assets/photo/2.jpg",
        "rating": 4.9,
        "reviewCount": 4156,
        "tags": ["日落", "蓝顶教堂", "摄影", "浪漫"],
        "openingHours": {
          "monday": "全天开放",
          "tuesday": "全天开放",
          "wednesday": "全天开放",
          "thursday": "全天开放",
          "friday": "全天开放",
          "saturday": "全天开放",
          "sunday": "全天开放",
        },
        "ticketInfo": {"entrance": "免费"},
        "visitDuration": 240,
        "difficulty": "easy",
        "facilities": ["restaurant", "cafe", "parking", "viewpoint"],
        "isAccessible": true,
        "phone": "",
        "website": "",
        "createdAt": "2024-01-01T00:00:00Z",
        "updatedAt": "2024-01-20T12:00:00Z",
      },
    ];
  }

  // 酒店数据
  static List<Map<String, dynamic>> getMockHotels() {
    return [
      {
        "_id": "hotel_001",
        "name": "圣托里尼恩典度假酒店",
        "nameEn": "Grace Hotel Santorini",
        "description": "位于伊亚小镇的豪华精品酒店，拥有绝佳的火山口和日落景观。每间套房都设有私人阳台和无边际泳池。",
        "destinationId": "dest_001",
        "category": "luxury",
        "starRating": 5,
        "latitude": 36.4618,
        "longitude": 25.3753,
        "address": "伊亚，圣托里尼 84702，希腊",
        "images": [
          "https://example.com/grace_hotel1.jpg",
          "https://example.com/grace_hotel2.jpg",
        ],
        "coverImage": "https://example.com/grace_hotel1.jpg",
        "rating": 4.8,
        "reviewCount": 892,
        "tags": ["豪华", "海景", "蜜月", "无边际泳池"],
        "priceRange": {"min": 800, "max": 2500, "currency": "EUR"},
        "amenities": [
          "wifi",
          "pool",
          "spa",
          "restaurant",
          "bar",
          "gym",
          "concierge",
          "room_service",
        ],
        "policies": {
          "checkin": "15:00",
          "checkout": "12:00",
          "cancellation": "免费取消48小时前",
        },
        "roomTypes": [
          {
            "name": "豪华海景套房",
            "size": "45",
            "maxGuests": 2,
            "amenities": ["阳台", "海景", "按摩浴缸"],
          },
          {
            "name": "总统套房",
            "size": "80",
            "maxGuests": 4,
            "amenities": ["私人泳池", "管家服务", "全景阳台"],
          },
        ],
        "phone": "+30 22860 28300",
        "email": "info@gracehotels.com",
        "website": "https://www.gracehotels.com",
        "isBookable": true,
        "createdAt": "2024-01-01T00:00:00Z",
        "updatedAt": "2024-01-20T12:00:00Z",
      },
      {
        "_id": "hotel_002",
        "name": "雅典大酒店",
        "nameEn": "Hotel Grande Bretagne Athens",
        "description": "雅典最具标志性的豪华酒店，位于宪法广场，步行即可到达卫城等主要景点。拥有150年历史的经典建筑。",
        "destinationId": "dest_002",
        "category": "luxury",
        "starRating": 5,
        "latitude": 37.9755,
        "longitude": 23.7348,
        "address": "宪法广场，雅典 10564，希腊",
        "images": [
          "https://example.com/grande_bretagne1.jpg",
          "https://example.com/grande_bretagne2.jpg",
        ],
        "coverImage": "https://example.com/grande_bretagne1.jpg",
        "rating": 4.7,
        "reviewCount": 1245,
        "tags": ["历史", "中心位置", "豪华", "商务"],
        "priceRange": {"min": 300, "max": 800, "currency": "EUR"},
        "amenities": [
          "wifi",
          "pool",
          "spa",
          "restaurant",
          "bar",
          "gym",
          "business_center",
          "parking",
        ],
        "policies": {
          "checkin": "15:00",
          "checkout": "12:00",
          "cancellation": "免费取消24小时前",
        },
        "roomTypes": [
          {
            "name": "经典客房",
            "size": "28",
            "maxGuests": 2,
            "amenities": ["市景", "大理石浴室"],
          },
          {
            "name": "行政套房",
            "size": "55",
            "maxGuests": 3,
            "amenities": ["卫城景观", "独立起居室", "行政酒廊"],
          },
        ],
        "phone": "+30 210 333 0000",
        "email": "info@grandebretagne.gr",
        "website": "https://www.grandebretagne.gr",
        "isBookable": true,
        "createdAt": "2024-01-01T00:00:00Z",
        "updatedAt": "2024-01-20T12:00:00Z",
      },
    ];
  }

  // 获取所有模拟数据
  static Map<String, dynamic> getAllMockData() {
    return {
      'users': getMockUsers(),
      'destinations': getMockDestinations(),
      'attractions': getMockAttractions(),
      'hotels': getMockHotels(),
    };
  }
}
